const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
module.exports = {
mode: 'none',
entry:'./src/main.js',
output:{
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
assetModuleFilename:'images/[hash][ext][query]'
}
plugins: [new HtmlWebpackPlugin({
template:'index.html'
})],
module:{
rules:[
{
test: /\.css$/i,
use:['style-loader','css-loader'],
},
],
},
{//加载css/less
test: /\.(css|less)$/i,
use: [
// compiles Less to CSS
'style-loader',
'css-loader',
'less-loader',
],
},
{//加载sass语法
test:/\.s[ac]ss$/i,
use：[
// 将JS字符串生成为style节点
'style-loader',
//将CSS转化成CommonJS模块
'css-loader',
// 将 Sass 编译成 CSS
'sass-loader',
],
},